package my.edu.model.information.entity.dto;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Null;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.groups.Default;
import lombok.Data;
import my.edu.common.validate.groups.Insert;
import my.edu.common.validate.IntegerPattern;

@Data
public class CustomerDTO {
    //groups中，Default.class是在不选择组的时候的校验，如果选择其他组，不对Default.class的参数进行校验
    //如果选择了对应组，仅仅只对加了对应组的参数进行校验
    //如果controller中不加组，则仅仅对没有加groups的参数进行校验

    @Null(message = "id必须为空", groups = Insert.class)
    @NotNull(message = "id不能为空" ,groups = { Default.class})
    private Long id;
    private Long customerCategoryId;//客户类别
    private Long priceFieldId;//价格字段
    @NotBlank(message = "客户编号不能为空", groups = {Insert.class, Default.class})
    private String customerNo;
    @NotBlank(message = "客户名称不能为空", groups = {Insert.class,  Default.class})
    private String customerName;
    private String paymentTerms;//收款条件
    private String region;//地区
    private String salesperson;//销售人员
    private String contactPerson;//联系人
    private Long salespersonId;//销售人员id
    private String taxIdentificationNumber;//税号
    private String bankName;//开户银行
    private String bankAccount;//银行帐号
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式错误", groups = {Insert.class, Default.class})
    private String phone;
    private String qqWechat;
    private String associatedRoute;//关联线路
    private Long associatedRouteId;//关联线路id
    private String province;//省
    private String city;//市
    private String district;//区
    private String deliveryAddress;//送货地址
    private String remark;
    @IntegerPattern(regexp = "^[01]$", message = "状态参数错误", groups = {Insert.class, Default.class})
    private Integer status;


}
